<?php
/**
 * oscshop2 B2C电子商务系统
 *
 * ==========================================================================
 * @link      http://www.oscshop.cn/
 * @copyright Copyright (c) 2015-2017 oscshop.cn. 
 * @license   http://www.oscshop.cn/license.html License
 * ==========================================================================
 *
 * @author    
 *
 */
 
namespace osc\mobile\controller;
use think\Db;
class Index extends MobileBase
{
 	function index(){

		cookie('jump_url',request()->url(true));


		$this->assign('SEO',['title'=>config('SITE_TITLE'),'name'=>config('SITE_NAME'),'keywords'=>config('SITE_KEYWORDS'),'description'=>config('SITE_DESCRIPTION')]);
		
		$this->assign('flag','index');

		$this->assign('list',Db::name('goods')->where(array('status'=>1,'is_home'=>1,'type'=>1))->order('rand()')->select());
		//获取公告
		$art1 = Db::name('article')->order('id desc')->where('status',1)->find();

		$this->assign('art1', $art1);
		$this->assign('slide', osc_system()->get_plugin_slide());
		$this->assign('empty','<li style="margin-left:10px;"><span style="line-height: 34px;">暂无记录~</span></li>');
		if(in_wechat())
		$this->assign('signPackage',wechat()->getJsSign(request()->url(true)));
		$this->assign('top_title','养老');
//		print_r(osc_system()->get_plugin_slide());exit;
        return $this->fetch('index');
    }
    function getartlist()
    {
    	$art1 = Db::name('article')->order('id desc')->select()->limit(1);
    	$this->assign('art1', $art1);
    	$this->assign('top_title','公告栏');
		$this->assign('SEO',['title'=>'公告栏-'.config('SITE_TITLE')]);
    	return $this->fetch('getartlist');
    }

    function getartinfo()
    {
    	$art1 = Db::name('article')->order('id desc')->select();
    	$this->assign('art1', $art1);
    	    	$this->assign('top_title','公告');
		$this->assign('SEO',['title'=>'公告-'.config('SITE_TITLE')]);
    	return $this->fetch('index');
    }


    public function ajax_goods_list(){

        $page=input('param.page');//页码

        $limit =6;
		
        $list= osc_goods()->ajax_get_goods($page,$limit);
		
		if(isset($list)&&is_array($list)){
				foreach ($list as $k => $v) {				
					$list[$k]['image']=resize($v['image'], 250, 250);		
				}
		}
		
        return  $list;
    }


	


	
	
}
